DECLARE @version smallint;
DECLARE @reqVersion smallint;

--Set required version number here 
SET @reqVersion = 1;

SELECT @version = VersionNumber
FROM SchemaVersion 
WHERE IsCurrent = 1;

IF (@version = @reqVersion)
BEGIN
--Update logic goes here

/* DROP UpToFiveKMPrice column*/
ALTER TABLE dbo.TaxiService DROP
	COLUMN UpToFiveKMPrice ;

/* ADD MinPriceKM column*/
ALTER TABLE dbo.TaxiService ADD
	MinPriceKM decimal(10,1) ;

/* ADD FreeWaitMinutes column*/
ALTER TABLE dbo.TaxiService ADD
	FreeWaitMinutes smallint ;

	
/* ADD WaitMinutePrice column*/
ALTER TABLE dbo.TaxiService ADD
	WaitMinutePrice smallint ;


--Updating version
INSERT INTO SchemaVersion(VersionNumber, IsCurrent) VALUES(@version + 1, 1);
UPDATE SchemaVersion SET IsCurrent = 0 WHERE VersionNumber = @version;
END ELSE
BEGIN
	print('ERROR! Incorrect version, please check updates for version' + CONVERT(varchar(10),@version));
END;	
